home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
seclau
/
checkalt.bas
next >
Wrap
BASIC Source File
|
1995-05-09
|
2KB
|
65 lines
' CheckAlt.bas - Check Status of Alt key to rewrite Progman.ini file
DEF SEG = 0
CONST False = 0
CONST True = -1
Dim HoldFile$(500)
LockOut = True
FOR X = 1 TO 40
PRINT ".";
FOR Y = 1 TO 500
KeyStat = PEEK(&H417)
IF (KeyStat AND &H8) + (KeyStat AND &H4) THEN LockOut = False
NEXT Y
NEXT X
RinUse = False
OPEN "\windows\progman.ini" FOR INPUT AS #1
WHILE NOT EOF(1)
LINE INPUT #1, IRec$
Ok2Use = True
IF INSTR(UCASE$(IRec$), "[RESTRICTIONS]") > 0 THEN
Ok2Use = False
RinUse = True
END IF
IF INSTR(UCASE$(IRec$), "NOFILEMENU=1") > 0 THEN
Ok2Use = False
RinUse = True
END IF
IF INSTR(UCASE$(IRec$), "NOSAVESETTINGS=1") > 0 THEN
Ok2Use = False
RinUse = True
END IF
IF Ok2Use THEN
RecCount = RecCount + 1
HoldFile$(RecCount) = IRec$
END IF
WEND
CLOSE #1
Y = RecCount
FOR X = Y TO 1 STEP -1
IF HoldFile$(X) = SPACE$(LEN(HoldFile$(X))) OR HoldFile$(X) = "" THEN RecCount = RecCount - 1
IF HoldFile$(X) <> SPACE$(LEN(HoldFile$(X))) AND HoldFile$(X) <> "" THEN EXIT FOR
NEXT X
IF LockOut = True AND RinUse = True THEN END
IF LockOut = False AND RinUse = False THEN END
OPEN "\windows\progman.ini" FOR OUTPUT AS #1
FOR X = 1 TO RecCount
PRINT #1, HoldFile$(X)
NEXT X
IF LockOut = True THEN
PRINT #1, " "
PRINT #1, "[restrictions]"
PRINT #1, "NoFileMenu=1"
PRINT #1, "NoSaveSettings=1"
END IF
CLOSE 1
END